home *** CD-ROM | disk | FTP | other *** search
- package java.io;
-
- import java.nio.channels.FileChannel;
- import sun.nio.ch.FileChannelImpl;
-
- public class FileInputStream extends InputStream {
- // $FF: renamed from: fd java.io.FileDescriptor
- private FileDescriptor field_0;
- private FileChannel channel;
-
- public FileInputStream(String var1) throws FileNotFoundException {
- this(var1 != null ? new File(var1) : null);
- }
-
- public FileInputStream(File var1) throws FileNotFoundException {
- this.channel = null;
- String var2 = var1 != null ? var1.getPath() : null;
- SecurityManager var3 = System.getSecurityManager();
- if (var3 != null) {
- var3.checkRead(var2);
- }
-
- if (var2 == null) {
- throw new NullPointerException();
- } else {
- this.field_0 = new FileDescriptor();
- this.open(var2);
- }
- }
-
- public FileInputStream(FileDescriptor var1) {
- this.channel = null;
- SecurityManager var2 = System.getSecurityManager();
- if (var1 == null) {
- throw new NullPointerException();
- } else {
- if (var2 != null) {
- var2.checkRead(var1);
- }
-
- this.field_0 = var1;
- }
- }
-
- private native void open(String var1) throws FileNotFoundException;
-
- public native int read() throws IOException;
-
- private native int readBytes(byte[] var1, int var2, int var3) throws IOException;
-
- public int read(byte[] var1) throws IOException {
- return this.readBytes(var1, 0, var1.length);
- }
-
- public int read(byte[] var1, int var2, int var3) throws IOException {
- return this.readBytes(var1, var2, var3);
- }
-
- public native long skip(long var1) throws IOException;
-
- public native int available() throws IOException;
-
- public void close() throws IOException {
- if (this.channel != null) {
- this.channel.close();
- }
-
- this.close0();
- }
-
- public final FileDescriptor getFD() throws IOException {
- if (this.field_0 != null) {
- return this.field_0;
- } else {
- throw new IOException();
- }
- }
-
- public FileChannel getChannel() {
- synchronized(this) {
- if (this.channel == null) {
- this.channel = FileChannelImpl.open(this.field_0, true, false, this);
- }
-
- return this.channel;
- }
- }
-
- private static native void initIDs();
-
- private native void close0() throws IOException;
-
- protected void finalize() throws IOException {
- if (this.field_0 != null) {
- FileDescriptor var10001 = this.field_0;
- if (this.field_0 != FileDescriptor.in) {
- this.close();
- }
- }
-
- }
-
- static {
- initIDs();
- }
- }
-